<?php

if(!defined('EXECROOT')) {
	define('EXECROOT','');
}

class lcarsEntry extends GtkEntry {

	private $width,$height;
	private $putx,$puty;
	private $colourNormal;

	public function __construct($colour1 = '#90c4fe') {
		parent::__construct();

		$this->colourNormal = $colour1;

		//. background.
		$this->modify_base(Gtk::STATE_NORMAL,GdkColor::parse('#000000'));
		
		//. border.
		$this->modify_bg(Gtk::STATE_NORMAL,GdkColor::parse($colour1));
		$this->modify_bg(Gtk::STATE_SELECTED,GdkColor::parse($colour1));
		
		//. text
		$this->modify_text(Gtk::STATE_NORMAL,GdkColor::parse('#ffffff'));
		$this->modify_font(new PangoFontDescription('Monospace'));
	
		$this->show_all();
		return;
	}

	public function getPosition() {
		return array($this->putx,$this->puty);
	}
	
	public function setPosition($fixed,$x,$y,$move = false) {
		$this->putx = $x;
		$this->puty = $y;
		if($move) {
			$fixed->move($this,$x,$y);
		} else {
			$fixed->put($this,$x,$y);
		}
		return;
	}
	
	public function setSize($w,$h) {
		$this->width = $w;
		$this->height = $h;
		$this->set_size_request($w,$h);
		return;
	}	
	
	public function getSize() {
		return array($this->width,$this->height);
	}

	public function setColour($colour) {
		if($colour === false) {
			$this->modify_bg(Gtk::STATE_NORMAL,GdkColor::parse($this->colourNormal));
			$this->modify_bg(Gtk::STATE_SELECTED,GdkColor::parse($this->colourNormal));		
		} else {
			$this->modify_bg(Gtk::STATE_NORMAL,GdkColor::parse($colour));
			$this->modify_bg(Gtk::STATE_SELECTED,GdkColor::parse($colour));
		}
		return;
	}
}

?>